package com.myaihui.controller.admin;

import com.myaihui.domain.SysUser;
import com.myaihui.foundation.constant.SysUserConstant;
import com.myaihui.foundation.msg.ResultMsg;
import com.myaihui.foundation.query.OrderQuery;
import com.myaihui.service.OrderService;
import com.myaihui.util.LoginUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2018/7/19
 * *******************************
 */
@Controller
@RequestMapping(value = "/fee")
public class FeeController {
    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/home")
    public ModelAndView home(){
        ModelAndView modelAndView = new ModelAndView("order/home");
        SysUser sysUser = LoginUtil.loginUser();
        if (sysUser.getType() == SysUserConstant.PM_ADMIN)
            modelAndView.addObject("propertyMgrId", sysUser.getPlatformId());
        if (sysUser.getType() == SysUserConstant.MARKET_ADMIN)
            modelAndView.addObject("marketId", sysUser.getPlatformId());
        return modelAndView;
    }

    @RequestMapping(value = "/page")
    @ResponseBody
    public ResultMsg page(OrderQuery query){
        return ResultMsg.success(orderService.findByConditions(query));
    }
}
